Custom Tables

Custom Tables are user defined database tables that can be used in one of two ways:

  • Local Only – Table is used on mobile device only and is not linked to an actual data source.

  • Remote ADO – Data will be downloaded from a remote ADO database, but the database columns and SQL query are user-defined.

  • Data can be downloaded from a remote database data source to a Custom Table but you cannot update a remote data source directly from a Custom Table. To upload data to a remote data source, you must first copy the data from the Custom Table into another type of Digitise Apps Data Source, using the SelectLocal Scripting Method.

 

You can create a Custom Table in one of the following ways:

  • Using the New Data Source option and manually defining the columns in the table

  • Using the Create as Custom Table … option to copy an existing Data Source to a Custom Table.

 

To create a Custom Table:

Choose New Data Source from the Project group of the Ribbon's Home tab. This will display a sub-menu of the different data source types.

Choose Custom Table.

Alternatively, right-click on an existing Data Source and choose Create as Custom Table… from the menu displayed.

 

The New Custom Table dialog box will be displayed.

If you used the Create as Custom Table option, this dialog will include a column in the new Table for each data item in the original Data Source. You can add additional data items to the Table or delete items from the original Data Source that you don't want in this Custom Table should you want to. You can do this in the same way as described below for a new table.

If you used the New Data Source option, the Table Columns section will be empty.

 

Enter a name for this Data Source in the Table Name field at the bottom of the dialog box.

To enter a new column to your custom table, click on the Add button below the Columns list. A new column will be added to the list and you can then edit the values for it by clicking in each table cell in turn that you want to edit.

To delete a column from the Table, select the column in the Columns table and then choose the Remove button.

When you have finished creating your Custom Table, click on the OK button.

 

Your new table will now be listed in the Data Sources Pane under Custom Tables – click on the Data Sources tab to display this pane if it isn't already in view. The Table will display in the tree view which you can expand and contract in the usual way.

Each node in the tree view has its own set of Properties. To display the Properties for a particular item, double-click on its node in the tree view. The Properties will then be displayed in the Properties Pane.

By default, a new Table is set to act as a Local Only table. If you want to define your own columns and SQL query, you will need to change the configuration to specify Remote ADO mode instead. This is done by editing the Mode Property for the Table.

Double-click on the Table Name in the Data Sources Pane to display the Table Properties. Click on the Mode Property value and choose the required setting from the drop-down list.

If you create a Custom Table from an existing Data Source, the Mode property will automatically be set to Remote ADO.

You may want to edit one or more of the other Properties as well.

The Table Properties available are:

  • When using Remote ADO mode for a Custom Table:

    • The order of columns output by the Select statement should match the order defined in the Custom Table.

    • There is no data-type checking, so ensure that the data types for the defined columns match those in the actual database.

    • Custom Tables in this mode can only be used for downloading data; data cannot currently be uploaded from them.

    • You can also specify the SQL Select statement or override a Select statement specified in the SQL Statement Property at runtime from within your Scripts, for example using the SelectLocal and SetSelectString Scripting Methods.

    • Select strings for use with Custom Tables can start with SELECT or SELECT DISTINCT.

    • Within a Select string, columns can be referred to using the format <table>.<column> but <table>.* is not supported.

    • You can use SQL stored procedures to download data to a Custom Table where more complex processing is required than is available using a standard SELECT statement. Stored procedures may allow you to move data processing from the device to a more powerful SQL server machine improving the efficiency of your apps. For more information about using stored procedures refer to the Knowledge Centre post in the Community Portal Area of our web site:

      Community Portal → Knowledge Centre→ Hints, Tips and FAQs → MX - Using SQL Stored Procedures in MX

      Note that whilst this Knowledge Centre post refers to Digitise Apps' predecessor MX, the contents applies equally to Digitise Apps.

    • When using a Custom Table within a Script, table names are referenced in the Script with the prefix Custom, e.g. Custom.MyCustomTable